package demo4;
public class Test {

    public static void eating(Animal animal){
        animal.eat();
    }

    public static void run(IRunning iRunning){
        iRunning.run();
    }

    public static void swim(ISwimming iSwimming){
        iSwimming.swim();
    }

    public static void fly(IFly iFly){
        iFly.fly();
    }

    public static void main(String[] args) {
        fly(new Duck("唐老鸭", 2));
        run(new Duck("唐老鸭", 2));
        swim(new Duck("唐老鸭", 2));
        run(new rebot());
        eating(new Duck("唐老鸭", 2));
    }

    public static void main2(String[] args) {
        Dog dog = new Dog("旺财", 2);
        Cat cat = new Cat("咪咪", 3);
        run(dog);
        swim(dog);

        run(cat);

    }
    public static void main1(String[] args) {
        eating(new Dog("旺财", 2));
        eating(new Cat("咪咪", 2));
    }
}
